using System;
using System.Data;

namespace FreeFlow.Administration
{
	/// <summary>
	/// A history item.
	/// </summary>
	public class HistoryItem
	{
		internal HistoryItem(IDataReader reader)
		{
      eventTime = (DateTime)reader["eEventTime"];
      if (reader["eEntryTime"] != System.DBNull.Value)
        entryTime = (DateTime)reader["eEntryTime"];
      else
        entryTime = Constants.NullDateTime;
      notes = reader["eNotes"].ToString();
      fromStage = reader["eFromStage"].ToString();
      toStage = reader["eToStage"].ToString();
      action = reader["eActionName"].ToString();
      user = reader["eUserName"].ToString();
      message = reader["eAlertMessage"].ToString();
      if (reader["eVersion"] is int)
        version = (int)reader["eVersion"];
      folderId = reader["eFolderID"].ToString();
		}

    private DateTime entryTime;
    /// <summary>
    /// Gets the date and time the folder entered the previous stage.
    /// </summary>
    public DateTime EntryTime
    {
      get
      {
        return entryTime;
      }
    }

    private DateTime eventTime;
    /// <summary>
    /// Gets the date and time the event occurred.
    /// </summary>
    public DateTime EventTime
    {
      get
      {
        return eventTime;
      }
    }

    private string notes;
    /// <summary>
    /// Gets the notes for this item.
    /// </summary>
    public string Notes
    {
      get
      {
        return notes;
      }
    }

    private string fromStage;
    /// <summary>
    /// Gets the name of the stage that the folder was leaving.
    /// </summary>
    public string FromStage
    {
      get
      {
        return fromStage;
      }
    }

    private string toStage;
    /// <summary>
    /// Gets the name of the stage that the folder was entering.
    /// </summary>
    public string ToStage
    {
      get
      {
        return toStage;
      }
    }

    private string action;
    /// <summary>
    /// Gets the name of the action the folder was in.
    /// </summary>
    public string Action
    {
      get
      {
        return action;
      }
    }

    private string user;
    /// <summary>
    /// Gets the name of the user.
    /// </summary>
    public string User
    {
      get
      {
        return user;
      }
    }

    private string message;
    /// <summary>
    /// Gets the message for this event.
    /// </summary>
    public string Message
    {
      get
      {
        return message;
      }
    }

    private int version;
    /// <summary>
    /// Gets the version of the procedure in use when this event occured.
    /// </summary>
    public int Version
    {
      get
      {
        return version;
      }
    }

    private string folderId;
    /// <summary>
    /// Gets the ID of the folder that caused this event.
    /// </summary>
    public string FolderId
    {
      get
      {
        return folderId;
      }
    }
	}
}
